﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Diagnostics;

namespace HomeFramework
{
    internal static class Log
    {
        private static Dictionary<string, TraceSource> Sources;
        private static int Counter=0;

        static Log()
        {
            Sources = new Dictionary<string, TraceSource>();
            foreach (var s in Enum.GetNames(typeof(SourceEnum)))
                Sources.Add(s, new TraceSource(s));
        }

        internal enum SourceEnum
        {
            HomeFrameworkApplication,
            HomeFrameworkEngine,
            WsdlGenerator,
        }

        internal static void WriteLine(SourceEnum source, TraceEventType type, string message, params string[] args)
        {
            Sources[Enum.GetName(typeof(SourceEnum), source)].TraceEvent(type, Counter++, message, args);
        }
    }
}